
// 根据经纬度获取城市，默认值latitude = 39.92, longitude = 116.46，北京市
function getCityName(latitude = 39.92, longitude = 116.46, resolve, reject) {
  wx.request({
    url: 'https://api.map.baidu.com/geocoder/v2/',
    data: {
      location: `${latitude},${longitude}`,
      output: 'json',
      ak: '7xGB99Yi2HXa6WxP1LAzi1gHHtxfhGMa',
    },
    header: { 'content-type': 'json' },
    success: resolve,
    fail: reject
  })
}
module.exports = { getCityName }